package com.troila.rpc;

import com.troila.client.grpc.core.Message;
import io.grpc.stub.StreamObserver;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MessageStreamListener implements StreamObserver<Message> {

    @Override
    public void onNext(Message message) {
        log.info("receive the message : {}", message);
    }

    @Override
    public void onError(Throwable throwable) {
        log.error("MessageListener onError", throwable);
    }

    @Override
    public void onCompleted() {
        log.info("MessageListener onCompleted");
    }
}
